package com.holyn.guofang.view.distinguish;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.holyn.guofang.R;
import com.holyn.guofang.view.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Holyn on 2017/7/25.
 */

public class ImgSimilarReplaceActivity extends BaseActivity {
    public static final String INTENT_KEY_READY_REPLACE_SON_IMG_URL = "INTENT_KEY_READY_REPLACE_SON_IMG_URL";

    @BindView(R.id.iv_main)
    ImageView ivMain;
    @BindView(R.id.btn_submit)
    Button btnSubmit;

    private String readyReplaceSonImgUrl = "";

    public static void startForResult(Activity fromActivity, String readyReplaceSonImgUrl, int requestCode){
        Intent intent = new Intent(fromActivity, ImgSimilarReplaceActivity.class);
        intent.putExtra(INTENT_KEY_READY_REPLACE_SON_IMG_URL, readyReplaceSonImgUrl);
        fromActivity.startActivityForResult(intent, requestCode);
    }

    @Override
    protected int getLayoutResID() {
        return R.layout.activity_img_similar_replace;
    }

    @Override
    protected void onMyCreate() {
        ButterKnife.bind(this);
        showToolbar("追加和替换近似图样");

        readyReplaceSonImgUrl = getIntent().getStringExtra(INTENT_KEY_READY_REPLACE_SON_IMG_URL);

        Glide.with(ImgSimilarReplaceActivity.this).load(readyReplaceSonImgUrl)
//                .error(R.drawable.ic_empty_image)
                .into(ivMain);

    }

    @OnClick(R.id.btn_submit)
    public void onViewClicked() {
        setResult(Activity.RESULT_OK, getIntent());
        ImgSimilarReplaceActivity.this.finish();
    }
}
